pkg: Switch from @js-temporal/polyfill to temporal-polyfill#3815
pkg: Switch from @js-temporal/polyfill to temporal-polyfill#3815
Conversation
temporal-polyfill is 60% smaller (19.8 KB vs 51.9 KB gzip), same spec compliance, and avoids JSBI. Website playground now uses native Temporal API when available (Chrome/Firefox/Edge) with polyfill fallback for Safari and older browsers. Made-with: Cursor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
|
Size Change: 0 B Total Size: 80.5 kB ℹ️ View Unchanged
|
There was a problem hiding this comment.
Benchmark React
Details
| Benchmark suite | Current: 177b9f7 | Previous: e6f05d7 | Ratio |
|---|---|---|---|
data-client: getlist-100 |
190.49 ops/s (± 4.9%) |
173.93 ops/s (± 4.2%) |
0.91 |
data-client: getlist-500 |
43.38 ops/s (± 8.9%) |
45.05 ops/s (± 8.3%) |
1.04 |
data-client: update-entity |
400 ops/s (± 6.3%) |
513.16 ops/s (± 7.1%) |
1.28 |
data-client: update-user |
416.67 ops/s (± 8.0%) |
454.55 ops/s (± 0.0%) |
1.09 |
data-client: getlist-500-sorted |
42.92 ops/s (± 9.2%) |
49.75 ops/s (± 1.2%) |
1.16 |
data-client: update-entity-sorted |
294.12 ops/s (± 7.5%) |
416.67 ops/s (± 0.0%) |
1.42 |
data-client: update-entity-multi-view |
344.83 ops/s (± 8.4%) |
384.62 ops/s (± 6.1%) |
1.12 |
data-client: list-detail-switch-10 |
13.02 ops/s (± 8.0%) |
13.24 ops/s (± 4.0%) |
1.02 |
data-client: update-user-10000 |
91.74 ops/s (± 4.9%) |
107.53 ops/s (± 4.0%) |
1.17 |
data-client: invalidate-and-resolve |
45.05 ops/s (± 5.1%) |
50.77 ops/s (± 5.7%) |
1.13 |
data-client: unshift-item |
277.78 ops/s (± 3.7%) |
307.77 ops/s (± 4.6%) |
1.11 |
data-client: delete-item |
454.55 ops/s (± 3.8%) |
384.62 ops/s (± 4.7%) |
0.85 |
data-client: move-item |
212.77 ops/s (± 5.9%) |
232.56 ops/s (± 5.6%) |
1.09 |
This comment was automatically generated by workflow using github-action-benchmark.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #3815 +/- ##
=======================================
Coverage 98.06% 98.06%
=======================================
Files 151 151
Lines 2843 2843
Branches 556 556
=======================================
Hits 2788 2788
Misses 11 11
Partials 44 44 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Benchmark
Details
| Benchmark suite | Current: 177b9f7 | Previous: eeda4b5 | Ratio |
|---|---|---|---|
normalizeLong |
437 ops/sec (±1.34%) |
447 ops/sec (±2.48%) |
1.02 |
normalizeLong Values |
401 ops/sec (±0.66%) |
419 ops/sec (±0.15%) |
1.04 |
denormalizeLong |
274 ops/sec (±3.24%) |
295 ops/sec (±2.45%) |
1.08 |
denormalizeLong Values |
266 ops/sec (±2.43%) |
268 ops/sec (±1.83%) |
1.01 |
denormalizeLong donotcache |
1031 ops/sec (±0.19%) |
1065 ops/sec (±0.33%) |
1.03 |
denormalizeLong Values donotcache |
771 ops/sec (±0.19%) |
772 ops/sec (±0.19%) |
1.00 |
denormalizeShort donotcache 500x |
1587 ops/sec (±0.11%) |
1576 ops/sec (±0.10%) |
0.99 |
denormalizeShort 500x |
834 ops/sec (±2.33%) |
1092 ops/sec (±0.12%) |
1.31 |
denormalizeShort 500x withCache |
6086 ops/sec (±0.30%) |
6086 ops/sec (±0.18%) |
1 |
queryShort 500x withCache |
2493 ops/sec (±0.08%) |
2738 ops/sec (±0.56%) |
1.10 |
buildQueryKey All |
54417 ops/sec (±0.26%) |
54218 ops/sec (±0.89%) |
1.00 |
query All withCache |
7955 ops/sec (±0.19%) |
6144 ops/sec (±0.65%) |
0.77 |
denormalizeLong with mixin Entity |
274 ops/sec (±2.40%) |
361 ops/sec (±0.20%) |
1.32 |
denormalizeLong withCache |
6265 ops/sec (±0.12%) |
7089 ops/sec (±0.24%) |
1.13 |
denormalizeLong Values withCache |
5133 ops/sec (±0.19%) |
5084 ops/sec (±0.19%) |
0.99 |
denormalizeLong All withCache |
7673 ops/sec (±0.16%) |
6032 ops/sec (±0.91%) |
0.79 |
denormalizeLong Query-sorted withCache |
8002 ops/sec (±0.16%) |
6263 ops/sec (±0.24%) |
0.78 |
denormalizeLongAndShort withEntityCacheOnly |
1704 ops/sec (±0.20%) |
1739 ops/sec (±0.16%) |
1.02 |
getResponse |
4648 ops/sec (±0.58%) |
4595 ops/sec (±0.46%) |
0.99 |
getResponse (null) |
10101497 ops/sec (±0.86%) |
10284649 ops/sec (±0.91%) |
1.02 |
getResponse (clear cache) |
263 ops/sec (±2.22%) |
344 ops/sec (±0.41%) |
1.31 |
getSmallResponse |
3328 ops/sec (±0.10%) |
3299 ops/sec (±0.67%) |
0.99 |
getSmallInferredResponse |
2559 ops/sec (±0.08%) |
2472 ops/sec (±0.64%) |
0.97 |
getResponse Collection |
4601 ops/sec (±0.44%) |
4527 ops/sec (±0.33%) |
0.98 |
get Collection |
4574 ops/sec (±0.42%) |
4591 ops/sec (±0.17%) |
1.00 |
get Query-sorted |
5243 ops/sec (±0.20%) |
4650 ops/sec (±0.29%) |
0.89 |
setLong |
451 ops/sec (±0.24%) |
463 ops/sec (±0.18%) |
1.03 |
setLongWithMerge |
258 ops/sec (±0.21%) |
262 ops/sec (±0.17%) |
1.02 |
setLongWithSimpleMerge |
272 ops/sec (±0.21%) |
278 ops/sec (±0.13%) |
1.02 |
setSmallResponse 500x |
953 ops/sec (±0.09%) |
958 ops/sec (±0.28%) |
1.01 |
This comment was automatically generated by workflow using github-action-benchmark.
Motivation
@js-temporal/polyfillis 51.9 KB gzip and relies on JSBI internally.temporal-polyfill(by FullCalendar's arshaw) is only 19.8 KB gzip with the same spec compliance (Mar 2025), no BigInt dependency, and supports global polyfill mode. With native Temporal now shipping in Chrome 144+, Firefox 139+, and Edge 144+, the website can use the native implementation when available while still delivering the polyfill for Safari and older browsers.Solution
@js-temporal/polyfill→temporal-polyfillacross root, website, packages (devDeps), and github-app example (7package.jsonfiles)website/src/components/Playground/temporal.tschecksglobalThis.Temporalat init — uses native API on supporting browsers, falls back to polyfill otherwise. Polyfill is still bundled (static import) for zero-latency fallbackPreviewWithScope.tsximports from the shim instead of the polyfill directlytemporal-spec(the actual type source) instead of the re-exportingtemporal-polyfill/index.d.tscopywebsitetypes.shscript all updated from@js-temporal/polyfill→temporal-polyfillOpen questions
N/A
Made with Cursor
Note
Medium Risk
Medium risk because it replaces a foundational date/time polyfill across packages, examples, tests, and the website playground (including Monaco type wiring), which could cause subtle runtime or typing regressions despite being mostly import/dependency changes.
Overview
Replaces
@js-temporal/polyfillwithtemporal-polyfillacross the repo (root/workspace packages, website, docs, tests, and the GitHub app example), updating allTemporal/Intlimports and lockfile entries accordingly.Updates the website Playground to be native-first by introducing a small
temporalshim that prefersglobalThis.Temporalwhen available, and adjusts Monaco/editor type loading to declare the new module name and copy Temporal types fromtemporal-specinstead of the old polyfill’s.d.ts.Written by Cursor Bugbot for commit 177b9f7. This will update automatically on new commits. Configure here.